#ifndef ___DCI_PROTOCOL
#define ___DCI_PROTOCOL 4




//================================================================================================================
//
//			Data declaration
//
//================================================================================================================

typedef union ComHeaderType
	{	struct 
			{	unsigned 	char 	sync;

				unsigned	DestGrp		:3;
				unsigned	DestGrpId	:3;
				unsigned	CommVerPri	:2;

				unsigned	SrcGrp		:3;
				unsigned	SrcGrpId	:3;
				unsigned	CommVerSec	:2;

				unsigned	MsgLen		:5;
				unsigned	OpCode		:3;

				unsigned	MsgId		:5;
				unsigned	StatCmd		:3;
			} Data;
		unsigned char access[5];
	};

typedef union IDUType
	{	struct 
		{	struct
			{	unsigned		IOprModeV		:3;
				unsigned		IOprInFlt		:1;
				unsigned						:4;  //dummy

				unsigned char	IOprCompNLoad;

				unsigned		IOprMVDiag		:5;
				unsigned		IOprPrtStat		:3;
				
				unsigned		IOprLstFlt		:6;
				unsigned		IXInfModel		:2;

				unsigned char	IOprIFan;

				unsigned		IOprMMode		:3;
				unsigned		IOprECM			:4;
				unsigned						:1; //dummy

				unsigned		RCOprSpt		:5;
				unsigned		RCOprMode		:3;

				unsigned		RCForcrStby		:1;
				unsigned		RCIfeelM		:1;
				unsigned		RCIonizer		:1;
				unsigned		RCFrshAir		:2;
				unsigned		RCOprFan		:2;
				unsigned		RCOprFanTurbo	:1;
			} IDUBasicData;

			struct
			{	unsigned		IXInfSVerPri	:4;
				unsigned		IXInfSVerSec	:4;

				unsigned		IXInfCap		:3;
				unsigned		IXInfFamily		:3;
				unsigned		Compensation	:1;
				unsigned		Night			:1;

				unsigned char	IEnvRAT;

				unsigned char	IEnvICT;

				unsigned		HE1				:1;
				unsigned		PUMP			:1;
				unsigned		IEnvICP			:3;
				unsigned		Clk				:1;
				unsigned		IOprFrshAir		:1;
				unsigned		IEnvIonizer		:1;

				unsigned		IOprRATM		:1;
				unsigned		IEnvICTBad		:2;
				unsigned		IENVRATBad		:2;
				unsigned		ResetNLOAD		:1;
				unsigned		IEnvESF			:1;
				unsigned						:1;

				unsigned		IOprSPT			:4;
				unsigned		IOprPrtRsn		:4;

				unsigned char	IOprCalcAT;

				unsigned char	IOprCompL;

				unsigned		IEnvRCT			:6;
				unsigned		IXInfFamily_1	:1;
				unsigned		IXInfFamily_2	:1;

				unsigned char	IEnvIFanActRPM;

				unsigned char	dummy;
			} IDUExtraData;
		}Data;
		unsigned char access[20];
	};


typedef union ODUType
	{	struct 
		{	struct
			{	unsigned		OOprMMode			:2;
				unsigned		OOPrModeV			:2;
				unsigned		OOprBaseHeat		:1;
				unsigned		ForceStby			:1;
				unsigned		OEnvRGTBad			:2;

				unsigned char	OOprCompCalcNLoad;

				unsigned		RVValue				:1;
				unsigned		OOprPrtStat			:3;
				unsigned		OOprPrtRsn			:3;
				unsigned		OOprInFlt			:1;

				unsigned		OOprLstFlr			:5;
				unsigned		OOprOFan			:3;

				unsigned char	OEnvCompCur;

				unsigned char	OEnvCompActFreq;

			} ODUBasicData;

			struct
			{	unsigned char	OOprEEVLSB;

				unsigned 		OOprEEVMSB			:2;
				unsigned		OOprCompForceOff	:1;
				unsigned							:3;
				unsigned		OEnvOMTBad			:2;

				signed char	OEnvOAT;

				signed char	OEnvOCT;

				signed char	OEnvCTT;

				signed char	OEnvHST;

				signed char	OEnvOMT;

				unsigned char	OEnvCompDCCurr;

				unsigned 		OOprMVDiag			:5;
				unsigned 		OEnvPwrBad			:3;

				unsigned 		OEnvOATBad			:2;
				unsigned 		OEnvOCTBad			:2;
				unsigned 		OEnvHSTBad			:2;
				unsigned 		OEnvCTTBad			:2;

				unsigned 		OOprECM				:4;
				unsigned 		ODUModel			:4;

				unsigned 		DeiceValid			:1;
				unsigned 		DeiceType			:1;
				unsigned 		TUnit				:3;
				unsigned 		IFanForceOff		:1;
				unsigned 		IFanForceHigh		:1;
				unsigned 		DisableHE			:1;

				unsigned 		OFANNSpd			:7;				
				unsigned 		OFANNSpd2			:1;
				
				unsigned 		IPPwrShed			:1;
				unsigned 		IPForceSTBY			:1;
				unsigned 		IPLoPres			:1;
				unsigned 		IPHiPres			:1;				
				unsigned 		CompDrvErr			:4;

			} ODUExtraData;
		}Data;
		unsigned char access[20];
	};

typedef union ITUType
	{	struct 
		{		unsigned char			dummy1;
				unsigned char			dummy2;

				unsigned int 			OOprEEV;			
				unsigned char			CompFreq;

				unsigned				OOprOFan		:3;
				unsigned				IOprMMode		:2;
				unsigned 				HSTEnable		:1;
				unsigned				twosparebits	:2;
		} Data;
		unsigned char access[6];
	};


//================================================================================================================
//
//			Function Prototypes
//
//================================================================================================================

//typedef enum {cderr_none=0,cderr_driver} CompressorDriveError ;

extern const char* const CompressorDriverError[];

typedef enum {invalid=0,Idu,Odu,kCOM,MSMP}en_group  ;
typedef enum {None=0,Setup,Dry,Test,Deice,E2PROM,Shutdown} Main_Mode_Variant;
typedef enum {STBY=0,COOL,HEAT,FAN,IDLE,INSTALLATION} Effective_Main_Mode;
typedef enum {OFF=0,VLOW,LOW,MED,HIGH,MAX} IFAN_logical_speed;
//typedef enum {OFF=0,VLOW,LOW,MED,HIGH,MAX} Outdoor_fan_speed;
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};
//typedef enum {};

#endif
